package com.duyus.ai.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
@RequestMapping("/test")
public class HealthyController {

//    private final ChatClient chatClientollama;

    // 请求方式和路径不要改动，将来要与前端联调
//    @RequestMapping(value = "/chat" , produces = "text/html;charset=utf-8")
//    public Flux<String> chat(@RequestParam(defaultValue = "讲个笑话") String prompt) {
//        return chatClientollama
//                .prompt(prompt) // 传入user提示词
//                .stream()
//                .content() //返回响应内容
//                .map(content -> new String(content.getBytes(), StandardCharsets.UTF_8)); // 确保正确的字符编码
////                .doOnNext(content -> System.out.println("Received content: " + new String(content.getBytes(), StandardCharsets.UTF_8))); // 打印日志
//        //                .call() // 同步请求，会等待AI全部输出完才返回结果
//    }

    @RestController
    @RequestMapping("/health")
    public class HealthController {

        @GetMapping
        public String healthCheck() {
            return "ok";
        }
    }

}
